package com.pac.weixin.dao.impl;

import java.util.List;

import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Repository;

import com.pac.weixin.bean.WxChatBean;
import com.pac.weixin.dao.WxChatDao;

/**
 * 微信聊天记录dao实现
 * 
 * @author lujun.chen
 * @version [版本号, 2015年2月26日]
 * @see [相关类/方法]
 * @since [产品/模块版本]
 */
@Repository(value = "wxChatDao")
public class WxChatDaoImpl implements WxChatDao {

	@Autowired
	private SqlSessionTemplate sqlSessionTemplate;

	@Override
	public String addWxChat(WxChatBean wxChatBean) {
		sqlSessionTemplate.insert("addWxChat", wxChatBean);
		return wxChatBean.getId();
	}

	@Override
	public boolean updateWxChat(WxChatBean wxChatBean) {
		int n = sqlSessionTemplate.update("updateWxChat", wxChatBean);
		return n > 0;
	}

	@Override
	public boolean delWxChat(WxChatBean wxChatBean) {
		int n = sqlSessionTemplate.delete("delWxChat", wxChatBean);
		return n > 0;
	}

	@Override
	public List<WxChatBean> queryWxChat(WxChatBean wxChatBean) {
		return sqlSessionTemplate.selectList("queryWxChat", wxChatBean);
	}

}
